The IOCTL Sample

The IOCTL Sample accompanies Chapter 9 and illustrates how to perform I/O Control operations.

The sample includes two components:

Building IOCTL

To build IOCTL.SYS, follow the general instructions for building a WDM sample. The Microsoft Visual C++ project file is named IOCTL.DSP in the SYS subdirectory.

To build TEST.EXE, follow the general instructions for building user-mode programs. The Microsoft Visual C++ project file is named TEST.DSP in the TEST subdirectory.

Testing IOCTL

Install IOCTL.SYS. Follow the general instructions for using FastInst in Windows 2000 or the Add New Hardware wizard in Windows 98. The INF file is named SYS\DEVICE.INF.

Now open a command prompt and execute TEST.EXE from the TEST\DEBUG subdirectory. TEST will issue three I/O Control operations that IOCTL services, and it will print the results.